package com.aspose.cells;

class zbrz extends zbz {
   private zbrw a = null;

   zbrz(zbrw var1) {
      this.c(176);
      this.a = var1;
      this.a();
   }

   int a(byte[] var1, int var2, CellArea var3) {
      System.arraycopy(com.aspose.cells.b.a.zc.a(var3.StartRow), 0, var1, var2, 2);
      System.arraycopy(com.aspose.cells.b.a.zc.a(var3.EndRow), 0, var1, var2 + 2, 2);
      System.arraycopy(com.aspose.cells.b.a.zc.a(var3.StartColumn), 0, var1, var2 + 4, 2);
      boolean var4 = false;
      if (var3.EndColumn > 255) {
         short var5 = 255;
         System.arraycopy(com.aspose.cells.b.a.zc.a((int)var5), 0, var1, var2 + 6, 2);
      } else {
         System.arraycopy(com.aspose.cells.b.a.zc.a(var3.EndColumn), 0, var1, var2 + 6, 2);
      }

      return 8;
   }

   void a() {
      int var1 = zakq.e(this.a.g);
      var1 += zakq.e(this.a.h);
      this.a((short)(44 + var1));
      this.c = new byte[this.d()];
      byte var2 = 0;
      PivotTable var3 = this.a.a;
      this.a(this.c, var2, var3.getTableRange1());
      int var9 = var2 + 8;
      CellArea var4 = var3.getColumnRange();
      int var5 = var4.StartRow + 1;
      int var6 = var4.EndRow + 1;
      if (this.a.c.getCount() != 0 && this.a.d.getCount() != 0 && this.a.e.getCount() == 0) {
         var6 = var4.EndRow + 1;
      }

      System.arraycopy(com.aspose.cells.b.a.zc.a(var3.m), 0, this.c, var9, 2);
      System.arraycopy(com.aspose.cells.b.a.zc.a(var6), 0, this.c, var9 + 2, 2);
      System.arraycopy(com.aspose.cells.b.a.zc.a(var4.StartColumn), 0, this.c, var9 + 4, 2);
      var9 += 6;
      if (var3.d != null) {
         System.arraycopy(com.aspose.cells.b.a.zc.a((short)var3.d.a()), 0, this.c, var9, 2);
      }

      System.arraycopy(com.aspose.cells.b.a.zc.a((short)0), 0, this.c, var9 + 2, 2);
      var9 += 4;
      if (this.a.c.getCount() < 2) {
         System.arraycopy(com.aspose.cells.b.a.zc.a((short)1), 0, this.c, var9, 2);
         System.arraycopy(com.aspose.cells.b.a.zc.a((int)65535), 0, this.c, var9 + 2, 2);
      } else {
         PivotField var7 = var3.getDataField();
         int var8 = var7.getPosition();
         switch(var7.m) {
         case 1:
            System.arraycopy(com.aspose.cells.b.a.zc.a((short)1), 0, this.c, var9, 2);
            if (var8 == var3.getRowFields().getCount() - 1) {
               var8 = -1;
            }
            break;
         case 2:
            System.arraycopy(com.aspose.cells.b.a.zc.a((short)2), 0, this.c, var9, 2);
            if (var8 == var3.getColumnFields().getCount() - 1) {
               var8 = -1;
            }
         }

         if (var8 == -1) {
            System.arraycopy(com.aspose.cells.b.a.zc.a((int)65535), 0, this.c, var9 + 2, 2);
         } else {
            System.arraycopy(com.aspose.cells.b.a.zc.a(var8), 0, this.c, var9 + 2, 2);
         }
      }

      var9 += 4;
      int var10 = this.a.b.getCount();
      System.arraycopy(com.aspose.cells.b.a.zc.a((short)var10), 0, this.c, var9, 2);
      var9 += 2;
      var10 = this.a.d.getCount();
      System.arraycopy(com.aspose.cells.b.a.zc.a((short)var10), 0, this.c, var9, 2);
      var10 = this.a.e.getCount();
      System.arraycopy(com.aspose.cells.b.a.zc.a((short)var10), 0, this.c, var9 + 2, 2);
      var10 = this.a.f.getCount();
      System.arraycopy(com.aspose.cells.b.a.zc.a((short)var10), 0, this.c, var9 + 4, 2);
      var10 = this.a.c.getCount();
      System.arraycopy(com.aspose.cells.b.a.zc.a((short)var10), 0, this.c, var9 + 6, 2);
      var9 += 8;
      int[] var11 = new int[]{var3.f(), var3.g()};
      var11[0] = var11[0] == 0 ? 1 : var11[0];
      var11[1] = var11[1] == 0 ? 1 : var11[1];
      System.arraycopy(com.aspose.cells.b.a.zc.a((short)var11[0]), 0, this.c, var9, 2);
      System.arraycopy(com.aspose.cells.b.a.zc.a((short)var11[1]), 0, this.c, var9 + 2, 2);
      var9 += 4;
      System.arraycopy(com.aspose.cells.b.a.zc.a(this.a.i), 0, this.c, var9, 2);
      var9 += 2;
      System.arraycopy(com.aspose.cells.b.a.zc.a(this.a.j), 0, this.c, var9, 2);
      var9 += 2;
      var10 = this.a.g.length();
      System.arraycopy(com.aspose.cells.b.a.zc.a((short)var10), 0, this.c, var9, 2);
      var9 += 2;
      var10 = this.a.h.length();
      System.arraycopy(com.aspose.cells.b.a.zc.a((short)var10), 0, this.c, var9, 2);
      var9 += 2;
      var9 += zco.a(this.c, var9, this.a.g);
      int var10000 = var9 + zco.a(this.c, var9, this.a.h);
   }
}
